home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / int24.zip / JAZ.H < prev    next >
Text File  |  1986-02-19  |  3KB  |  108 lines

  1. /*
  2. ┌────────────────────────────────────────────────────────────────────────────┐
  3. │ Title   : jaz.h                                 │
  4. │ Purpose : Define general purpose macros for use in my programs         │
  5. │                                         │
  6. │    Written by Jack Zucker - 75766,1336    301-794-5950  on 1/15/85      │
  7. └────────────────────────────────────────────────────────────────────────────┘
  8. */
  9.  
  10. /* given a segment and offset, return a pointer which will point to the */
  11. /* seg:off pair                             */
  12.  
  13. #define LPOINTER(type,seg,ofs) (type far *) ((long) seg << 16 | ofs)
  14.  
  15.  
  16. /* ──────────────── define various memory peek macros. ──────────────── */
  17.  
  18. /* this one returns a char */
  19. #define MEMB(seg,ofs) (*LPOINTER(unsigned char,seg,ofs))
  20.  
  21. /* this one returns a word */
  22. #define MEMW(seg,ofs) (*LPOINTER(unsigned int,seg,ofs))
  23.  
  24. #define MEML(seg,ofs) (*LPOINTER(long,seg,ofs))
  25. /* this one returns a long */
  26.  
  27. /* ──────────────── define a macro for avoiding snow.  ──────────────── */
  28.  
  29. /* this next macro will wait for the horizontal retrace status bit to */
  30. /* avoid snow. Much more elegant than writing the routines in masm    */
  31.  
  32. #define WAITSCR while (inp(0x3da) & 1) ; while (! (inp(0x3da) & 1)) ;
  33.  
  34. struct tfat {
  35.   long        free;
  36.   long        total;
  37.   long        used;
  38. } ;
  39. #define TFAT struct tfat
  40.  
  41.  
  42. #if LINT_ARGS
  43. /*global*/  unsigned char  *jzgetfat(int ,int  *,int  *,int  *);
  44. #else
  45. unsigned char *jzgetfat();
  46. #endif
  47.  
  48. struct REGW {
  49.   unsigned int ax,bx,cx,dx,si,di,ds,es,flags;
  50. };
  51.  
  52. struct REGB {
  53.   unsigned char al,ah,bl,bh,cl,ch,dl,dh;
  54. };
  55.  
  56. union TREG {
  57.   struct REGW x;
  58.   struct REGB h;
  59. };
  60.  
  61. struct tname {
  62.   char *filename;
  63.   struct tname *next;
  64. };
  65. #define TNAME struct tname
  66.  
  67. struct thead {
  68.   int listlen;
  69.   struct tname *first,*last;
  70. };
  71. #define THEAD struct thead
  72.  
  73. THEAD *rsplist();
  74. THEAD *dirlist();
  75.  
  76. struct tregx {            /* define a register struct for bios calls */
  77.   unsigned int ax,bx,cx,dx,si,di,ds,es,flags;
  78. };
  79.  
  80. struct tregh {
  81.   unsigned char al,ah,bl,bh,cl,ch,dl,dh;
  82. };
  83.  
  84. union treg {
  85.   struct tregx x;
  86.   struct tregh h;
  87. };
  88. #define TREG union treg
  89.  
  90. struct tvector { unsigned int offset,segment; };
  91. #define TVECTOR struct tvector
  92.  
  93. /*global*/  void intr(int , TREG *);
  94. /*global*/  int rindex(char *,char);
  95. /*global*/ char *tabtosp(char *,char *);
  96. /*global*/ void jzdskfre(TFAT *,int);
  97. /*global*/ char *jzpad(int , int);
  98. /*global*/ void jzgetint(int,TVECTOR *);
  99. /*global*/ int jzinstr(char*,int,int,int,int,long,char*);
  100. /*global*/ char *jzrgtjst(char *,int);
  101. /*global*/ void jzdelay(long);
  102. /*global*/ char *jzstrpos(char *,char*);
  103. #define msdos(_wreg) intr(0x21,_wreg)    /* define turbo like msdos call */
  104. #define hibyte(x) (unsigned int) x & 0xff
  105. #define lobyte(x) (unsigned int) x >> 8
  106. #define max(x,y) (x > y ? x : y)
  107. #define min(x,y) (x < y ? x : y)
  108.